package cn.iocoder.yudao.module.tms.dal.mysql.training;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.tms.controller.admin.training.vo.TrainingMaterialPageReqVO;
import cn.iocoder.yudao.module.tms.dal.dataobject.training.TrainingMaterialDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 培训资料 Mapper
 */
@Mapper
public interface TrainingMaterialMapper extends BaseMapperX<TrainingMaterialDO> {

    default PageResult<TrainingMaterialDO> selectPage(TrainingMaterialPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TrainingMaterialDO>()
                .likeIfPresent(TrainingMaterialDO::getName, reqVO.getName())
                .eqIfPresent(TrainingMaterialDO::getType, reqVO.getType())
                .betweenIfPresent(TrainingMaterialDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TrainingMaterialDO::getId));
    }

}